home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 476-500 / disk_494 / vscreen / vscreen.doc < prev    next >
Text File  |  1992-05-06  |  22KB  |  423 lines

  1. OVERVIEW:
  2.  
  3. VSCREEN allows you to have screens that are larger than the actual display 
  4. area of your monitor.  These larger "virtual" screens scroll when you move the
  5. mouse off the edge of the visible section of the screen.  vScreen allows you
  6. to create a screen large enough for a full page of editing, for example.  Not
  7. all programs are set up to take advantage of vScreen, however, but most 
  8. programs that provide winodow-sizing gadgets can benefit from vScreen.
  9.  
  10. WARNING:  vScreen does devious and illegal things with the INTUITIONPRIVATE
  11. section of the IntuitionBase structure.  Use it at your own risk.  vScreen is
  12. likely to be incompatible with a future release of the system software.
  13.  
  14.  
  15. HOW TO USE VSCREEN:
  16.  
  17. You should place vScreen in your C: directory (or in your current PATH).  
  18. vScreen-Handler should be in the L: directory (or the current directory).  To
  19. start vScreen, issue the following command:
  20.  
  21.     1> VSCREEN width height ["screen-name"]
  22.  
  23. where  width  is the new width for the virtual screen,  height  is the new
  24. height, and  "screen-name"  is the name of the screen that you want to make
  25. larger.  If the screen name includes spaces or other special characters, you
  26. should enclose it in quotation marks.  If you do not supply a screen name, 
  27. vScreen will enlarge the active screen.  
  28.  
  29. The width and height should be at least as large as the current size of the
  30. screen, and width and height should not be larger than 1024 (see the section
  31. titled USAGE NOTES below).
  32.  
  33. For example, if you type
  34.  
  35.     1> VSCREEN 800 400
  36.  
  37. then the workbench screen will be enlarged to 800 by 400.
  38.  
  39. When you receive the "vScreen Installed" message, your screen will be a
  40. virtual screen of the size you specified.
  41.  
  42. To view other parts of the virtual screen, simply move the mouse off the edge
  43. of the visible portion of the screen so that it moves over the portion of the
  44. screen that you want to see.  For example, if the upper left-hand corner of
  45. the screen is showing, and you want to see the lower right-hand corner, just
  46. move the mouse off the lower right-hand edge of the display.  The screen will
  47. scroll to show you more of the screen in the direction that you moved the
  48. mouse. 
  49.  
  50. Note that the screen will scroll even when you are doing things that normally 
  51. "lock" the screen.  For example, if you are changing the size of a window or
  52. dragging a window, and you move the mouse off the edge of the displayed
  53. portion of the screen, the screen will still scroll.  The screen will not
  54. scroll if you are dragging the screen, however, or if the virtual screen is 
  55. not the active screen.
  56.  
  57. You can force the screen to scroll without moving the mouse to the edge of the
  58. screen by holding down the left-amiga key and moving the mouse.  This scrolls
  59. the virtual screen while keeping the mouse at the same location on the display.
  60.  
  61. Note:  you can only have one virtual screen at a time under the current
  62. release of vScreen (1.0.1).
  63.  
  64.  
  65. If you want to remove vScreen and restore the normal sized screen, simply call
  66. vScreen again:
  67.  
  68.     1> VSCREEN
  69.  
  70. You should receive a "vScreen removed" message.  vScreen will make sure that 
  71. all the windows currently open on the screen are moved and sized so that they 
  72. will fit on the normal sized screen.
  73.  
  74.  
  75. USAGE NOTES:
  76.  
  77. When you enlarge a window using vScreen, the entire new screen is stored in
  78. CHIP memory (not just the part that is currently showing).  For this reason,
  79. vScreen may use up large pieces of CHIP memory.  Don't specify a screen that
  80. is too large for the amount of memory that you have.  vScreen does not recover
  81. well from low-memory conditions.
  82.  
  83. Although vScreen will allow you to specify a screen wider than 1024, you
  84. should be aware that screens of this size can be a problem.  The blitter has a
  85. limitation on the size of a block that it will move.  The RKM puts this limit
  86. at 976 (see BltBitMap() in the autodocs), but empirical testing indicates that 
  87. values up to 1024 will work.  Above this size, blit operations fail to work
  88. properly, so in a screen larger than 1024, dragged window may not update
  89. correctly and the menu bar will not appear. 
  90.  
  91. Similarly, screens taller than 1024 lines also can cause update problems.
  92.  
  93. vScreen will allow you to specify dimentions that are SMALLER than the current
  94. screen, but this is not recommended.  vScreen will not function properly if a
  95. screen is reduced in size.  Unexpected display effects will occur when the
  96. screen is scrolled.
  97.  
  98. Due to the method used to display only a portion of the larger screen,
  99. dragging a screen may incur noticably more overhead than usual.  This occurs
  100. only when the virtual screen is the top-most screen and there is another
  101. screen visable.  See the section on HOW VSCREEN WORKS for more details.
  102.  
  103. vScreen inserts an input handler in the Input.Device input chain and uses the
  104. SetFunction() routine to replace Intuition and Graphics library routines.  For
  105. this reason, only one copy of vScreen should be running at one time.  This
  106. means that, under the current version of vScreen, you may only have one
  107. virtual screen at a time.  If there is popular demand, a future release will
  108. lift this restriction, and will provide a programmer's interface to vScreen.
  109.  
  110. If the virtual screen closes while vScreen is running, vScreen will become
  111. disabled, but will not actaully be removed from the input chain or the library
  112. vector tables (in order to keep the resident portion of vScreen as small as
  113. possible, these functions are performed by the loader).  In order to actually
  114. remove vScreen from the system, you must call vScreen a second time.  Note
  115. that if you have set the workbench screen as a virtual screen and an
  116. application calls CloseWorkBench() (and the screen actually closes), then when
  117. the workbench is opened again, it no longer will be a virtual screen:  it will
  118. have changed back to its original size.  You will have to remove the old copy
  119. of vScreen (by calling vScreen with no parameters), and then re-install it to
  120. make the workbench virtual again.
  121.  
  122. vScreen works with all view modes (lo-res, hi-res, interlace and HAM).  HAM
  123. screens, however, may have discoloration along the left border when the left
  124. edge is not showing.  This is due to the fact that the left edge of the
  125. display will be the background color rather than the color of the previous
  126. pixel that is not being displayed.
  127.  
  128. If the active screen is in front of the virtual screen and you move the mouse 
  129. so that it passes over the virtual screen, then the top window of the virtual 
  130. screen will become active (and the previous active screen will become 
  131. inactive).  See the section on HOW VSCREEN WORKS for more details on why
  132. this is necessary under the current release of Intuition.
  133.  
  134. The Intuition window structure includes fields for the maximum size that the
  135. window may have.  Most current programs that allow their windows to be
  136. sized specify that the windows can be made arbitrarily large.  Some older
  137. programs, however, specify maximum sizes equal to a standard sized screen 
  138. (e.g. 640 x 200).  These windows may not be able to grow as large as a virtual
  139. screen.  For this reason, vScreen comes with a number of utilities that help
  140. you to manipulate windows "by hand" (see OTHER UTILITIES below).
  141.  
  142.  
  143. OTHER UTILITIES:
  144.  
  145. vScreen comes with four utility programs to help you manipulate windows on
  146. virtual screens:  wSize wMove wMax and wList.
  147.  
  148. wSize allows you to change the size of any window, even if it does not have a
  149. window sizing gadget.  To use wSize, issue the command:
  150.  
  151.     1> wSize dx dy ["window" ["screen" [IGNOREMAX]]]
  152.  
  153. where  dx  and  dy  are the number of pixels that the window should grow by in
  154. the  x  and  y  directions (note that negative values are allowed).  "Window"
  155. is the name of the window that is to be changed (if the name includes spaces
  156. or other special characters it should be enclosed in quotation marks).  If no
  157. name is specified then the active window is changed.  "Screen" is the name of
  158. the screen where the window can be found (enclosed in quotation marks of the
  159. name includes spaces).  If no screen name is specified then the active screen
  160. is used.  The window will not shrink smaller than its minimum allowable size
  161. (as stored in its window structure), and it will not grow larger than the 
  162. size of the screen, nor larger than its maximum size (as stored in its window
  163. structure) unless IGNOREMAX is specified.
  164.  
  165. For example:
  166.  
  167.     1> wSize 50 25 "AmigaDOS"
  168.  
  169. will increase the size of the window named "AmgiaDOS" (on the current screen)
  170. by 50 pixels in the  x  direction and 25 in the  y  direction.
  171.  
  172. You can use wSize to enlarge backdrop windows on screens that have them. 
  173. This is useful, for instance, for paint programs that render your picture
  174. into a backdrop window without a sizing gadget.
  175.  
  176.  
  177. wMove is similar to wSize, except that it moves the window rather than change
  178. its size.  The parameters are the same (except there is no IGNOREMAX flag):
  179.  
  180.     1> wMove dx dy ["window" ["screen"]]
  181.  
  182. where  dx  and  dy  are the amounts by which to move the window, "window" is 
  183. the name of the window to move, and "screen" is the screen where that window 
  184. can be found.  The screen defaults to the current screen, and the window 
  185. defaults to the active window.  A window will not be moved off the edge of 
  186. the screen.
  187.  
  188.  
  189. wMax allows you to change the maximum size setting that is stored in the
  190. window's structure.  Call it with the following parameters:
  191.  
  192.     1> wMax x y ["window" ["screen"]] 
  193.  
  194. where  x  is the maximum size horizontally, y  is the maximum size vertically, 
  195. "window" is the name of the window to change, and "screen" is the name of the
  196. screen where that window can be found.  If the screen or window name contains 
  197. a space or special character, enclose the name in quotation marks.  If no
  198. screen is specified, the active screen is used.  If no window is specified,
  199. the active window is changed.  A size of -1 means that the window can be
  200. stretched to any size in that direction.
  201.  
  202. For example:
  203.  
  204.     1> wMax -1 -1
  205.  
  206. allows the active window to grow to any size.
  207.  
  208.  
  209. wList prints a list of all the windows on a specific screen, or all the
  210. screens:
  211.  
  212.     1> wList ["screen"]
  213.  
  214. where "screen" is the name of the screen whose windows will be listed.  If 
  215. the screen name includes spaces or special characters, then enclose it in
  216. quotation marks.  If no screen name is specified, then the names of all the 
  217. windows on all the screens are printed.
  218.  
  219. For example:
  220.  
  221.     1> wList "Workbench Screen"
  222.  
  223. will list the names of all the windows on the workbench.
  224.  
  225.  
  226. HOW VSCREEN WORKS:
  227.  
  228. The graphics library defines a structure called a View, which represents the
  229. entire visible area of the display.  The View is broken down into separate
  230. ViewPorts.  Each ViewPort can have its own view mode (hi-res, interlace, HAM,
  231. etc.), and each ViewPort can be a different size.
  232.  
  233. Intuition maintains a View (called the ViewLord), where each ViewPort
  234. corresponds to an Intuition Screen (that's how screens can be of different
  235. sizes and resolutions).  Windows within those screens have no direct analog
  236. in the Graphics library (they correspond to Layers in the Layers library).
  237.  
  238. Each ViewPort has a related RasInfo structure that includes a pointer to its
  239. bitmap.  When vScreen runs, it allocates new, larger bitplanes for the
  240. ViewPort, and copies the data from the old planes into the new ones.  This
  241. provides a larger bitmap for the corresponding screen.  Once this larger
  242. bitmap is in place, all graphics calls proceed normally, as the Graphics
  243. library handles the larger bitmap without trouble.
  244.  
  245. The RasInfo structure also includes two other fields:  RxOffset and RyOffset.
  246. These represent the upper, left-hand corner of the section of bitmap that will 
  247. appear within the ViewPort.  Translated into Intuition terms, this tells what 
  248. part of a Screen's larger bitmap will be showing.  vScreen uses these offsets 
  249. to allow you to scroll the virtual screen; no memory is copied, so the 
  250. scrolling is very fast.
  251.  
  252. Unfortunately, Intuition does not take these offsets into account when it
  253. figures the position of the mouse (when buttons are pressed, gadgets are
  254. clicked, etc.).  The bulk of the vScreen-Handler is devoted to tricking
  255. Intuition into handling these offset values correctly.
  256.  
  257. Initially, vScreen sets the screen width and height to the new size of the
  258. screen.  When MakeScreen() is called for the virtual screen, and the screen is
  259. the front screen, Intuition will set the ViewPort height to be the height of
  260. the screen.  This would cause the screen to become an "overscan" screen when 
  261. it's not supposed to be.  
  262.  
  263. Ideally, vScreen would trap the MakeScreen() call and change the value back.  
  264. Unfortunately, however, MakeScreen() is called by RethinkDisplay() and 
  265. RemakeDisplay(), which are both called by Intuition itself (when a new screen 
  266. is opened or moved, for example).  Since Intuition does not call its own jump 
  267. table vectors, we are not able to trap ALL the calls to MakeScreen(), so that 
  268. is not an effective method of fixing the problem.
  269.  
  270. Most often, after a MakeScreen() call, there will be calls to MrgCop() and
  271. LoadView() (this is what happens with RethinkDisplay() and RemakeDisplay()). 
  272. Since LoadView() is in the Graphics library, not the Intuition library,
  273. Intuition DOES call LoadView() through the graphics library vector table. 
  274. This provides a viable hook that we can use to fix the overscan problem. 
  275. Whenever LoadView() is called on the Intuition ViewLord, we check that the
  276. ViewPort for the virtual screen does not have a height that is too large.  If
  277. it does, we reduce the height and call MrgCop() again (this is what slows down
  278. dragging the virtual screen when it is on top).
  279.  
  280. This fix to LoadView() makes the larger virtual screens display properly for
  281. any given set of RxOffset and RyOffset.  The input handler is what changes
  282. these offsets.  The handler adds up all the mouse movements within the input
  283. event list, and adds them to the current Intuition MouseX and MouseY values. 
  284. If these would cause the mouse to move off the edge of the displayed area of
  285. the screen, then the handler sets the offsets so that the mouse stays on the
  286. screen.  The handler also checks for forced shifts (left amiga held down while 
  287. moving the mouse).
  288.  
  289. Once the screen is shifted, however, the mouse X and Y values can get very
  290. large.  When Intuition positions the sprite that represents the mouse pointer,
  291. it does not take RxOffset and RyOffset into account and hence can position
  292. the pointer off the edge of the display.  For this reason, vScreen traps the
  293. MoveSprite() graphics function, and when the virtual screen is active and
  294. sprite zero is positioned, vScreen compensates for the offsets itself.  This
  295. guarantees that the mouse pointer is positioned over the correct part of the
  296. shifted virtual screen.
  297.  
  298. Intuition uses the MaxDisplayRows and MaxDisplayWidth to calculate the range
  299. of X and Y values over which the mouse can travel (MinXMouse, MaxXMouse,
  300. MinYMouse, and MaxYMouse).  The min and max values are changed when you drag a
  301. window or screen, and when you change a window's size through its sizing
  302. gadget.  In order to make it possible to move windows over the entire area of
  303. the virtual screen, vScreen modifies the MaxDisplay values that Intuition uses.
  304.  
  305. At this point, the virtual screen works correctly; however, interactions
  306. between the virtual screen and other screens do not.  Intuition does not take
  307. into account the RasInfo offsets when it calculates the position of the top of
  308. the screen.  For example, if the virtual screen is shifted vertially so that 
  309. the top 20 lines are not showing, and another screen is visible behind the 
  310. virtual screen, and you click in that screen but within 20 lines of the top of
  311. the virtual screen, Intuition will think you clicked in the virtual screen
  312. itself (in the upper area that is not currently showing).  Worse yet, if you
  313. click higher up in the other screen (over 20 lines above the top of the
  314. virtual screen), Intuition will see that you hit the other screen, but will
  315. think the mouse is 20 lines lower than it is.  This is because the Intuition
  316. MouseY value is off by RyOffset pixels.
  317.  
  318. To avoid these problems, vScreen monitors the mouse movements to tell when the
  319. mouse changes from being over the virtual screen to being over some other
  320. screen.  When the pointer moves over some other screen, vScreen resets the
  321. MouseX and MouseY values to their normal positions.  That way, if a mouse
  322. click occurs in the other screen, it will occur at the proper place.  When the
  323. pointer moves back over the virtual screen, the MouseX and MouseY are returned
  324. to their positions relative to the virtual screen's RxOffset and RyOffset
  325. values.
  326.  
  327. This works fine whenever the virtual screen is the active screen and the
  328. pointer moves over another screen either in front of or behind the virtual
  329. screen.  It also works if a screen behind the virtual screen is active and
  330. the mouse moves over the virtual screen.  It does not work, however, if a
  331. screen in front of the virtual screen is active and the mouse moves over the
  332. virtual screen.  In this case, if the MouseY value were changed and the mouse
  333. button pressed, Intuition would incorrectly think the mouse was positioned 
  334. over the active screen.  For this reason, when a non-virtual screen is active
  335. and in front of the virtual screen, and the mouse moves over the virtual
  336. screen, the virtual screen is activated.  This is not consistant with normal
  337. Intuition actions, but does ensure that mouse clicks will be reported correctly.
  338.  
  339. Normally, you can move the mouse pointer past the top edge of a screen so that
  340. it is over another screen and the virtual screen will not scroll until the
  341. pointer hits the top of the physical display.  If you are dragging a window,
  342. however, or are holding down the menu button, or doing some other action that 
  343. locks the screen layers, then the screen will scroll when you move the pointer
  344. past the top of the screen (rather than waiting until it reaches the top of
  345. the display).  This makes it easier to select menus when the screen is
  346. scrolled vertically, for instance.
  347.  
  348. If an AutoRequest() occurs on the virtual screen, the screen will automatically
  349. shift so that the upper left-hand corner is showing (just like the screen
  350. where an AutoRequest occurs will be brought to the front).
  351.  
  352. If BuildSysRequest() is called on the virtual screen, then rather than shift 
  353. the screen, vScreen moves the request window so that it appears in the upper 
  354. left-hand corner of the displayed area of the screen.  Ideally, this is what 
  355. we should do for AutoRequest(), but since Intuition does not call its own 
  356. vector table, we can not trap the BuildSysRequest() call made by AutoRequest().
  357.  
  358. Finally, vScreen traps calls to CloseScreen() so that it can tell when the
  359. virtual screen is closed.  If the virtual screen closes, vScreen will cease
  360. all its functions, but will not actually restore the trapped vectors or remove
  361. the input handler or free its memory until you remove vScreen by calling
  362. vScreen a second time.
  363.  
  364. I do not recommend that you use this approach in your own programs. 
  365. Modifying, or even viewing, the INTUITIONPRIVATE data structure is frowned
  366. upon by Commodore-Amiga, and will make your programs unreliable in future
  367. versions of Intuition.  Furthermore, if more than one program uses this
  368. method, they will probably interact destructively.  If there is sufficient
  369. demand, and provided Commodore does not incorporate something like this in a
  370. future release of Intuition, I may be convinced to put this functionality
  371. into a library with a callable interface for programs to use.
  372.  
  373.  
  374. COMPILING VSCREEN:
  375.  
  376. vScreen was developed using the Lattice C compiler v4.0 on a 512K Amiga 1000.
  377. It probably will need to be changed in order to work with Manx Aztec C.  To
  378. compile and link vScreen use the following commands:
  379.  
  380.     1> lc -v -b0 vScreen vScreenSetup vScreen-Handler
  381.     1> asm vScreenStubs
  382.     1> blink with vScreen.lnk
  383.     1> blink with vScreen-Handler.lnk
  384.  
  385. I prefer not to use the Lattice function prototypes, but I like to use the
  386. direct-library-call preprocessor commands, therefore, I have modified my
  387. prototype include files to remove the function prototypes (via an #ifdef).
  388. If you compile the source files with the -dPROTO flag, then the Lattice proto
  389. include files will be used (there will be compile-time warnings), otherwise,
  390. they will not be included.
  391.  
  392.  
  393. AUTHOR:
  394.  
  395. vScreen and vScreen-Handler
  396. Copyright 1988 by Davide P. Cervone, All rights reserved.
  397.  
  398. You may distribute this program and source code for non-commercial purposes, 
  399. provided you include this documentation.  You may not ditribute this program 
  400. as part of a commercial product without the author's written permission.  
  401. You may not include this source code as part of your own programs.
  402.  
  403. (Sorry about the restrictions on the use of vScreen, but I think that using
  404. the INTUITIONPRIVATE stuff is a terrible thing to do, and I don't want it to
  405. appear in any commercial products.  I'm hoping that Commodore-Amiga will pick
  406. up on the idea and incorporate it into Intuition, where it belongs, and where
  407. it would be much easier to do.  If they don't, then I plan to do my own
  408. virtual screen library, and I don't want anyone else's programs to break, or
  409. to get in the way).
  410.  
  411. If you find an interesting use for vScreen, please drop me a note.
  412.  
  413.  
  414. AUTHOR:
  415.  
  416. vScreen and vScreen-Handler
  417. Copyright (c) 1988 by Davide P. Cervone, all rights reserved.
  418.  
  419. Davide P. Cervone
  420. Department of Mathematics, Box 1917                 ST402523@BROWNVM.BITNET
  421. Brown University                                    st402523@brownvm.brown.edu
  422. Providence, Rhode Island  02912                     dpvc@fermat.math.brown.edu
  423.